
package holdem.Rulegui;
import java.io.Serializable;
import java.util.Scanner;

public class Gene implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 4696743458508765585L;
	boolean mutate = true;
	int value = 0;
	
	
	public Gene(){}
	/**
	 * 
	 * @param tempint the number gene code is
	 * @param tempbool if it can change true for yes false for no
	 */
	
	public Gene(int tempint, boolean tempbool) {
		mutate = tempbool;
		value = tempint;
		
	}
	public void set(int i){
		 value = i;
	}
	public int get(){
		return value;
	}
	
	public boolean isMut(){
		return mutate;
	}
	
	public void flip(){
		mutate = !mutate;
	}
	
	public void setEvolave(Boolean isActive){
		mutate = isActive;
	}
	
	public String saveString(){
		String Rval =value + " ";
		Rval += mutate ? 1+"" :0+"";
		return Rval;
		
		
	}
	public static Gene Load(String string) {
		Scanner scan = new Scanner(string);
		int i = scan.nextInt();
		boolean b = scan.nextInt() == 1? true :false;;
		
		return new Gene(i,b);
	}
}
